<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="com.gzgi.framework.config.mail.*"%>
<%@ include file="/pages/system/checkAdmin.jsp"%>
<%
       String contextPath = request.getContextPath();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>邮件服务配置</title>
 <link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/pages/styles/styles.css" />


<script language="JavaScript">
  String.prototype.trim = function() {
     return this.replace(/(^\s*)|(\s*$)/g, "");
  }

 function submitRequest(form, actionType){
    var host = document.getElementById("host").value.trim();
	var mailFrom = document.getElementById("mailFrom").value.trim();
	var text = document.getElementById("text").value.trim();
	document.getElementById("actionType").value = actionType;

    if(host == ""){
		alert("邮件服务器地址不能为空！");
		document.getElementById("host").focus();
		return ;
	 }
	if(mailFrom == ""){
		alert("邮件发送者不能为空！");
		document.getElementById("mailFrom").focus();
		return ;
	 }
	 if(text == ""){
		alert("邮件内容不能为空！");
		document.getElementById("text").focus();
		return ;
	 }

    if(actionType == "reconfig"){
       if(confirm("您真的要重新配置邮件服务，确认吗？")){
	        form.submit();
	   }
	}else{
		form.submit();
	}

 }

</script>
<body>
<center><br>
<br>

<form name="dataItemForm" method="post" action="saveMailConfig.jsp"
	class="x-form"><input type="hidden" id="actionType"
	name="actionType" value="test"> <input type="hidden" id="auth"
	name="auth" value="false">
<div class="content-block"  style=" width: 585px;" >
<br>
<div class="x_content_title"><img
	src="<%=request.getContextPath()%>/pages/images/window.png"
	alt="邮件服务配置">&nbsp;邮件服务配置 
 </div>

<fieldset class="x-fieldset" style=" width: 95%;">
<legend>基本属性</legend>

<table border=0 cellspacing=0 cellpadding=2>
<tbody>
 <tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px">
      <span class="field-name-required">邮件服务器地址 *</span>
  </td>
  <td> 
  <input id="host"
	name="host" size="40" class="x-text" maxlength="255" value="">
  </td>
 </tr>

<tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px">
      <span class="field-name-required">发送端口 *</span>
  </td>
  <td> 
  <input id="port"
	name="port" size="40" class="x-text" maxlength="5" value="25">
  </td>
 </tr>

<tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px">
      <span class="field-name-required">发送者名称 *</span>
  </td>
  <td> 
  <input id="mailFrom"
	name="mailFrom" size="40" class="x-text" maxlength="255" value="">
  </td>
 </tr>

<tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px">
       用户名 
  </td>
  <td> 
  <input id="username"
	name="username" size="40" class="x-text" maxlength="255" value="">
  </td>
 </tr>

<tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px">
       密码 
  </td>
  <td> 
  <input id="password"
	name="password" type="password" size="41" class="x-text"
	maxlength="255" value=""> 
	</td>
 </tr>

<tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px">
     是否需要认证 
  </td>
  <td>
  <input type="radio"
	name="x_auth"
	onclick="javascript:document.getElementById('auth').value=true;">
      需要
   <input type="radio" name="x_auth"
	onclick="javascript:document.getElementById('auth').value=false;">
     不需要  
  </td>
 </tr>

<tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px">邮件编码  
  </td>
  <td>
    <select name="encoding">
	    <option value="GBK">GBK</option>
		<option value="GB2312">GB2312</option>
		<option value="GB18030">GB18030</option>
		<option value="BIG5">BIG5</option>
		<option value="UTF-8">UTF-8</option>
		<option value="UTF-16">UTF-16</option>
		<option value="ISO-8859-1">ISO-8859-1</option>
    </select>  
  </td>
 </tr>

<tr class="x-content-hight">
  <td style="width: 140px; padding-right: 10px"> 请填写测试文本 *  </td>
  <td>
  <textarea id="text"
	name="text" rows="6" cols="32" class="x-form-textarea"></textarea>
  </td>
 </tr>

</table>
</fieldset>

<div align="center"><br />

<input type="button" class="button" value="重新配置"
	onclick="javascript:submitRequest(this.form, 'reconfig');" /> <input
	type="button" class="button" value="测试连接"
	onclick="javascript:submitRequest(this.form, 'test');" /> <br />
<br />
</div>

 
</div>
</form>
</center>
<br />
<br />